<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});
Route::group(["prefix"=>"admin","namespace"=>"Admin","as"=>"admin."],function (){
    # 后台登录模块
    Route::get("login","LoginController@index")->name("index");
    # 接收登录数据
    Route::post("login","LoginController@login")->name("login");
    # 页面展示
    # Route::get("index","IndexController@index")->name("index");
    # 欢迎页面
    # Route::get("welcome","IndexController@welcome")->name("welcome");
    # 创建es索引
    Route::get("es/create","ExController@create")->name("es.create");
    # 退出登录
    # Route::get("login","LoginController@logout")->name("logout");
    Route::group(["middleware"=>["checkadminlogin"]],function (){
        # 首页页面展示
        Route::get("index","IndexController@index")->name("index");
        # 欢迎页面
        Route::get("welcome","IndexController@welcome")->name("welcome");
        # 退出登录
        Route::get("logout","IndexController@logout")->name("logout");
        # 个人信息
        Route::get("messages","IndexController@messages")->name("messages");
        # 修改个人信息展示
        Route::get("edits/{id}","IndexController@edits")->name("edits");
        # 处理个人信息数据
        Route::put("msgupdata/{id}","IndexController@msgupdata")->name("msgupdata");
        # 用户管理
        # 用户页面
        Route::get("admin.user","AdminController@index")->name("admin.user");
        # 展示添加页面
        Route::get("admin.insert","AdminController@insert")->name("admin.insert");
        # 接收添加数据处理
        Route::post("admin.create","AdminController@create")->name("admin.create");
        # 修改用户页面展示
        Route::get("admin.edit/{id}","AdminController@edit")->name("admin.edit");
        # 修改用户数据处理
        Route::put("admin.update/{id}","AdminController@update")->name("admin.update");
        # 软删除用户
        Route::delete("admin/destory/{id}","AdminController@destory")->name("admin.destory");
        # 全删除 restore
        Route::get("admin.deleteAll","AdminController@deleteAll")->name("admin.deleteAll");
        # 恢复软删除数据
        Route::get("admin.restore/{id}","AdminController@restore")->name("admin.restore");
        # 真删除
        Route::delete("admin/deletes/{id}","AdminController@deletes")->name("admin.deletes");
        # 软删除列表
        Route::get("admin.softDeletes","AdminController@softDeletes")->name("admin.softDeletes");
        # 角色管理
        # 添加角色列表展示
        # Route::get("role.inset","RoleController@index")->name("role.inset");
        # 添加角色数据处理
        # Route::post("role.store","RoleController@store")->name("role.store");
        # 定义资源路由 会自定义好七个路由，有 增删改查，显示单条数据
        Route::match(["get","post"],"role/auth/{role}","RoleController@auth")->name("role.auth");
        # 增 create  增加数据处理 store  修改 edit 修改数据处理 update 删除destroy 显示所有数据列表 index  显示单条数据show
        Route::resource("role","RoleController");
        # 权限管理
        Route::resource("node","NodeController");
//        Route::get("atr","CtrController@index")->name("atr");
        # 上传图片处理
        Route::post("article.upfile","ArticleController@upfile")->name("article.upfile");
        # 删除图片
        Route::get("article.deletePic","ArticleController@deletePic")->name("article.deletePic");
        # 文章访问数量
        Route::get("article/count","ArticleController@count")->name("article.count");
        # 文章管理
        Route::resource("article","ArticleController");

        # 定义房源路由
        # 上传图片处理
        Route::post("fangattr.upfile","FangattrController@upfile")->name("fangattr.upfile");
        # 删除图片
        Route::get("fangattr.deletePic","FangattrController@deletePic")->name("fangattr.deletePic");
        # 文章管理
        Route::resource("fangattr","FangattrController");

        # 定义房东路由
        # 上传图片处理
        Route::post("fangowner.upfile","FangownerController@upfile")->name("fangowner.upfile");
        # 导出Export路由
        Route::get("fangowner.excel","FangownerController@excel")->name("fangowner.excel");
        # 生成Excel ，生产者
        Route::get("fangowner.createecel","FangownerController@createecel")->name("fangowner.createecel");
        # 删除图片
        Route::get("fangowner.deletePic","FangownerController@deletePic")->name("fangowner.deletePic");
        # 文章管理
        Route::resource("fangowner","FangownerController");

        # 房源管理
        # 上传图片
        Route::post("fang.upfile","FangownerController@upfile")->name("fang.upfile");
        # 房源地区
        Route::get("fang.area","FangController@area")->name("fang.area");
        Route::resource("fang","FangController");

        # 预约管理
        Route::resource("notice","NoticeController");

        # api小程序接口
        Route::resource("apiuser","ApiuserController");
    });
});

